import 'package:flutter/material.dart';
void main() => runApp(MyApp());
//应用结构
class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context){
    return MaterialApp(
      title: 'flutter widget',
      //应用程序的主题，各种的定制颜色都可以设置，用于程序主题切换
      theme: ThemeData(
        //主题色 蓝色
        primarySwatch: Colors.blue,
      ),
      home:Scaffold(
        appBar: AppBar(
          title: Text('Flutter之image组件'),
          centerTitle: true,
          primary: true, //是否设置内容避开状态栏
        ),
        body:Center(
//          child: new Image.asset('images/image-2.jpg'),
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              new Text(
                '1、图片加载方式——本地资源加载',
                style: TextStyle(
                  fontSize: 20,
                  color: Colors.blue,
                  fontWeight: FontWeight.bold,
                  fontFamily: 'HanaleiFill'
                ),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new Image.asset(
                  'images/image-0.png',
                  width: 450.0,
                  height: 200.0,
                  fit: BoxFit.none,
                  color: Colors.yellow,
                  colorBlendMode: BlendMode.colorBurn,
                  repeat: ImageRepeat.repeatX,
                ),
              ),
              new Text(
                '2、图片加载方式——网络加载方式',
                style: TextStyle(
                    fontSize: 20,
                    color: Colors.blue,
                    fontWeight: FontWeight.bold,
                    fontFamily: 'HanaleiFill'
                ),
              ),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new Image.network(
                  'http://i1.whymtj.com/uploads/tu/201903/9999/0682f53504.jpg',
                  scale: 0.2,
                  width: 350.0,
                  height: 200.0,
                ),
              ),
//              new Padding(
//                padding: const EdgeInsets.all(10.0),
//                child: new Image.asset(
//                  'images/image-0.png',
//                  width: 450.0,
//                  height: 200.0,
//                  fit: BoxFit.none,
//                  color: Colors.yellow,
//                  colorBlendMode: BlendMode.colorBurn,
//                  repeat: ImageRepeat.repeatX,
//                ),
//              )
            ],
          ),
        )
      )
    );
  }
}
